//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_CONFIGURED_RT_TYPES_H
#define _UX_CONFIGURED_RT_TYPES_H

#include "../../../Resources/PostProcess/PostProcessTypes.h"

namespace Engine
{
namespace RenderUtils
{
	
	struct TMaterialStateLock
	{
		e_render_layer::bits		eLayer;
		e_render_state_lock::type	eLock;
		///
		TMaterialStateLock(): eLayer(e_render_layer::UNKNOWN_BITS), eLock(e_render_state_lock::UNKNOWN) {}
	};
	_CREATE_META_OBJECT_FD( TMaterialStateLock );


	struct TGLState
	{
		e_gl_state::type		eState;
		bool					bEnabled;
		///
		TGLState(): eState(e_gl_state::BLEND), bEnabled(false) {}
	};
	_CREATE_META_OBJECT_FD( TGLState );


	struct TRTSetGLStatesPass
	{
		string						sName;
		TGLRenderState				sState;
		e_render_state_lock::type	eRSLock;
		array<TGLState>				aStates;
		///
		TRTSetGLStatesPass(): eRSLock(e_render_state_lock::UNKNOWN) {}
	};
	_CREATE_META_OBJECT_FD( TRTSetGLStatesPass );


	struct TRTBindTexturesPass
	{
		string					sName;
		array<TTexBindParams>	aTextures;
		///
		TRTBindTexturesPass() {}
	};
	_CREATE_META_OBJECT_FD( TRTBindTexturesPass );


	struct TRTSetRenderTargetsPass
	{
		string					sName;
		array<TRTAttachParams>	aTargets;
		///
		TRTSetRenderTargetsPass() {}
	};
	_CREATE_META_OBJECT_FD( TRTSetRenderTargetsPass );


	struct TRTCyclePass
	{
		string					sName;
		string					sPass;
		ivec3					vIterations;	// first, last, step
		///
		TRTCyclePass(): vIterations(1,1,1) {}
	};
	_CREATE_META_OBJECT_FD( TRTCyclePass );


	struct TRTCustomPass
	{
		string					sName;
		string_array_t			aPasses;
		///
		TRTCustomPass() {}
	};
	_CREATE_META_OBJECT_FD( TRTCustomPass );


	struct TRTBranchPass
	{
		string					sName,
								sIfValue,
								sThenPass,
								sElesePass;
		///
		TRTBranchPass() {}
	};
	_CREATE_META_OBJECT_FD( TRTBranchPass );


	struct TRTCase
	{
		string					sPassName;
		uint					uValue;
		///
		TRTCase(): uValue(0) {}
	};
	_CREATE_META_OBJECT_FD( TRTCase );


	struct TRTSwizzlePass
	{
		string					sName,
								sValue,
								sDefaultPass;
		array< TRTCase >		aCase;
		///
		TRTSwizzlePass() {}
	};
	_CREATE_META_OBJECT_FD( TRTSwizzlePass );


	struct TRTPostProcessPass
	{
		string					sName,
								sPostProcess;
		array<TTexBindParams>	aInputTextures;
		array<TRTAttachParams>	aOutputTextures;
		///
		TRTPostProcessPass() {}
	};
	_CREATE_META_OBJECT_FD( TRTPostProcessPass );
	

	struct TRTShadowTech
	{
		string					sPassName;
		float					fMinRadius,
								fMaxRadius;
		e_light::type			eLightType;
		e_shadow::type			eShadowType;
		///
		TRTShadowTech():
			fMinRadius(0.f), fMaxRadius(0.f), eLightType(e_light::UNKNOWN), eShadowType(e_shadow::UNKNOWN)
		{}
	};
	_CREATE_META_OBJECT_FD( TRTShadowTech );


	struct TRTDeferredLight
	{
		string					sProgram,
								sMode;
		e_light::type			eLightType;
		e_shadow::type			eShadowType;
		///
		TRTDeferredLight(): eLightType(e_light::UNKNOWN), eShadowType(e_shadow::UNKNOWN) {}
	};
	_CREATE_META_OBJECT_FD( TRTDeferredLight );


	struct TRTSetupLighting
	{
		string					sName;
		array<TRTShadowTech>	aShadows;
		array<TRTDeferredLight>	aLights;
		///
		TRTSetupLighting() {}
	};
	_CREATE_META_OBJECT_FD( TRTSetupLighting );


	struct TConfiguredRTInit
	{
		array< TRTSetGLStatesPass >		aGLStatesPasses;
		array< TRTPostProcessPass >		aPostProcessPasses;
		array< TRTCustomPass >			aCustomPasses;
		array< TRTBranchPass >			aBranchPasses;
		array< TRTSwizzlePass >			aSwizzlePasses;
		array< TRTCyclePass >			aCyclesPasses;
		array< TRTSetRenderTargetsPass>	aSetRTPasses;
		array< TRTBindTexturesPass >	aBindTexPasses;
		array< TRTSetupLighting >		aSetupLighting;

		array< TMaterialStateLock >		aLocks;
		array< TRenderTarget >			aRenderTargets;
		string_array_t					aPasses;
		string_array_t					aPrograms;
		string_array_t					aConsole;
		e_technique::type				eType;
		///
		TConfiguredRTInit(): eType(e_technique::UNKNOWN) {}
	};
	_CREATE_META_OBJECT_FD( TConfiguredRTInit );

//-------------------------------------------------------------------

}	// RenderUtils
}	// Engine

#endif	// _UX_CONFIGURED_RT_TYPES_H